package Volatile;

import java.util.concurrent.TimeUnit;

public class Hello_Volatile {
    boolean running = true;
    void m(){
        System.out.println("m start");
        while (running){
        }
        System.out.println("m end");
    }

    public static void main(String[] args) {
        Hello_Volatile hello_volatile = new Hello_Volatile();
        new Thread(hello_volatile::m,"t1").start();
        try {
            TimeUnit.MILLISECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        hello_volatile.running = false;
    }
}
